Skip to content

Add --abbrev-commit, --format=oneline and --oneline to the log subcommand#118

Merged
ianthomas23 merged 3 commits intoQuantStack:mainfrom
SandrineP:log_oneline
Mar 11, 2026
Merged

Add --abbrev-commit, --format=oneline and --oneline to the log subcommand#118
ianthomas23 merged 3 commits intoQuantStack:mainfrom
SandrineP:log_oneline

Conversation

@SandrineP
Copy link
Collaborator

@SandrineP SandrineP commented Mar 10, 2026

Fix #91
Add --abbrev-commit, format=oneline and --oneline to the log subcommand
Add <rev> to the revparse subcommand
Add -annotate to the tag subcommand
(The last two ones being useful for the tests)

@SandrineP SandrineP added the enhancement New feature or request label Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.40%. Comparing base (e0f7ab9) to head (b66f83d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
- Coverage   86.83%   86.40%   -0.44%     
==========================================
  Files          60       60              
  Lines        2340     2420      +80     
  Branches      275      290      +15     
==========================================
+ Hits         2032     2091      +59     
- Misses        308      329      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@ianthomas23 ianthomas23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one change requested, and a note about future work.


std::string message = commit.message();
while (!message.empty() && message.back() == '\n')
message.pop_back();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add surrounding curly braces

if (!obj.has_value())
{
throw git_exception("bad revision '" + rev + "'", git2cpp_error_code::BAD_ARGUMENT);
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for return after throwing

}
else

if (!m_revisions.empty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use else if to avoid return statement in the previous if.

std::cout << git_oid_tostr_s(&oid) << std::endl;
}
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using else here would avoid the need for the previous return statement

@SandrineP SandrineP force-pushed the log_oneline branch 2 times, most recently from 8e664af to 8ff057c Compare March 11, 2026 10:30
@ianthomas23 ianthomas23 merged commit 1ab489a into QuantStack:main Mar 11, 2026
5 of 6 checks passed
@SandrineP SandrineP deleted the log_oneline branch March 11, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: git log --oneline

3 participants